<template name="livechatTagForm">
	{{#if hasLicense}}
		{{#requiresPermission 'manage-livechat-tags'}}
			<form id="tag-form" data-id="{{tag._id}}">
				<div class="rocket-form">
					{{#if Template.subscriptionsReady}}
						<fieldset>
							<div class="input-line">
								<label>{{_ "Name"}}</label>
								<div>
									<input type="text" class="rc-input__element" name="name" value="{{tag.name}}" placeholder="{{_ "Name"}}" />
								</div>
	        				</div>
	            			<div class="input-line">
	              				<label>{{_ "Description"}}</label>
	              				<div>
	                				<textarea name="description" class="rc-input__element" rows="6">{{tag.description}}</textarea>
	              				</div>
	            			</div>
							<hr />
						</fieldset>
						<h2>{{_ "Departments"}}</h2>
							<fieldset>
								<legend>{{_ "Available_departments"}}</legend>

								{{#if hasAvailableDepartments }}
									<ul class="tag-departments available-departments">
										{{#each availableDepartments}}
											<li><i class="icon-plus-circled"></i>{{name}}</li>
										{{/each}}
									</ul>
								{{else}}
									{{_ "There_are_no_departments_available"}}
								{{/if}}
							</fieldset>

							<fieldset>
								<legend>{{_ "Selected_departments"}}</legend>

								{{#if selectedDepartments}}
									<div class="list">
										<table>
											<thead>
												<tr>
													<th width="75%">{{_ "Name"}}</th>
													<th>&nbsp;</th>
												</tr>
											</thead>
											<tbody>
												{{#each selectedDepartments}}
													<tr class="department-info">
														<td>{{name}}</td>
														<td><a href="#remove" class="remove-department"><i class="icon-trash"></i></a></td>
													</tr>
												{{/each}}
											</tbody>
										</table>
									</div>
								{{else}}
									{{_ "There_are_no_departments_added_to_this_tag_yet"}}
								{{/if}}

							</fieldset>


						<div class="rc-button__group">
							<button class="rc-button back" type="button"><i class="icon-left-big"></i><span>{{_ "Back"}}</span></button>
							<button class="rc-button rc-button--primary save"><i class="icon-floppy"></i><span>{{_ "Save"}}</span></button>
						</div>
					{{else}}
						{{> loading}}
					{{/if}}
				</div>
			</form>
		{{/requiresPermission}}
	{{/if}}
</template>
